﻿using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    /// <summary>
    /// GovOfficeRegionBO class
    /// </summary>
    public static class GovOfficeRegionBO
    {
        /// <summary>
        /// GovOfficeRegionDao object
        /// </summary>
        private static readonly GovOfficeRegionDao Dao = new GovOfficeRegionDao();

        /// <summary>
        /// Gets the gov office regions.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">Start index of the row.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns>GovOfficeRegion list</returns>
        public static IQueryable<GovOfficeRegion> GetGovOfficeRegions(GovOfficeRegionFilter filter, string sortType,
                                                                      int startRowIndex, int maxRows)
        {
            return Dao.GetList(filter, sortType, startRowIndex, maxRows);
        }

        /// <summary>
        /// Gets the gov office region by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>GovOfficeRegion object</returns>
        public static GovOfficeRegion GetGovOfficeRegionById(int id)
        {
            return Dao.GetGovOfficeRegionById(id);
        }

        /// <summary>
        /// Gets the gov office regions count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetGovOfficeRegionsCount(GovOfficeRegionFilter filter)
        {
            return Dao.GetListCount(filter);
        }
    }
}